package de.connecttext.dao.sql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;


/**
 * USE UTF-8 !!!! EVERYWHERE !!!
 * @author conrad
 *
 */
public class SqlConnection {

	//private static String url = "jdbc:mysql://crazyhorse.archaeologie.uni-koeln.de/connecttext";
	private static String url = "jdbc:mysql://localhost/connecttextWikipedia2?useUnicode=true&characterEncoding=utf8";
	private static String user = "root";
	//private static String password = "tosso";
	private static String password = "";
	
	public static Connection open() throws ClassNotFoundException, SQLException {
		Class.forName("com.mysql.jdbc.Driver");
		Connection connection = DriverManager.getConnection (url, user, password);
		Statement createStatement = connection.createStatement();
		createStatement.execute("SET NAMES 'utf8'");
		createStatement.execute("SET CHARACTER SET 'utf8'");
		createStatement.close();
		return connection;
	}
	
	
}
